class MyTest {
  init = (callBack) => {
    this.callBack = callBack;
  };

  generatePrimes = (start, range) => {
    let primes = [];
    let isPrime = true;
    let end = start + range;
    for (let i = start; i < end; i++) {
      for (let j = start; j < Math.sqrt(end); j++) {
        if (i !== j && i % j === 0) {
          isPrime = false;
          break;
        }
      }
      if (isPrime) {
        primes.push(i);
      }
      isPrime = true;
    }
    console.log("generatePrimes end");
    if (this.callBack) {
      this.callBack(`generatePrimes end, start:${start}, range:${range}`);
    }
    return primes;
  };

  fib = (n) => {
    if (n == 0) return 0;
    else if (n == 1) return 1;
    else return this.fib(n - 1) + this.fib(n - 2);
  };
}

const myTest = new MyTest();
module.exports = myTest;
